<template>
  <div>
    <div class="box_top">
      <router-link to @click.native="navshow()">
        <span>{{navmsg}}</span>
        <img src="../../assets/images/展开.png" alt>
      </router-link>
    </div>
    <div class="box_nav">
      <ul>
        <li @click="newnav(1,$event)" ref="menuItem">实时</li>
        <li @click="newnav(2,$event)" ref="menuItem">一天</li>
        <li @click="newnav(3,$event)" ref="menuItem">七天</li>
        <li @click="newnav(4,$event)" ref="menuItem">三十天</li>
      </ul>
    </div>

    <div v-if="this.page==1">
      <div class="box_for">
        <div class="for_title">成交额</div>
        <div class="for_money">0</div>

        <div class="for_msg">
          <div class="msg_first">
            <span>前一天</span>
            <span>368.00</span>
          </div>
          <div class="msg_last">
            <span>上周同期</span>
            <span>368.00</span>
          </div>
        </div>
        <div class="his">
          <div class="his_first">
            <span>近四周平均</span>
            <span>360.00</span>
          </div>
          <div class="his_last">。。。。。。。。</div>
        </div>
      </div>
          <div class="biao">
             <div class="biao_title">成交额近30日趋势图</div>
              <div id="myChart" :style="{width: '100%', height: '180px',left:0}"></div>
          </div>
      <div class="bom">
        <div class="bom_title">详细数据</div>
        <div class="bom_sun">
          <span> &nbsp;日期</span>
          <span> &nbsp;成交额</span>
          <span>较前日</span>
        </div>

        <div class="bom_box">
          <ul>
            <li>
              <span>03-25</span>
              <span>366.00</span>
              <span>+10%</span>
            </li>
              <li>
              <span>03-25</span>
              <span>366.00</span>
              <span>+10%</span>
            </li>
              <li>
              <span>03-25</span>
              <span>366.00</span>
              <span>+10%</span>
            </li>
              <li>
              <span>03-25</span>
              <span>366.00</span>
              <span>+10%</span>
            </li>
              <li>
              <span>03-25</span>
              <span>366.00</span>
              <span>+10%</span>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <div v-else-if="this.page==2">2
      <div class="biao">
             <div class="biao_title">成交额近30日趋势图</div>
              <div id="myChart" :style="{width: '100%', height: '180px',left:0}"></div>
          </div>
    </div>
    <div v-else-if="this.page==3">3</div>
    <div v-else>4</div>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      his: 1,
      navmsg: "实时",
      page: 1,
       msg: 'Welcome to Your Vue.js App'
    };
  },
  mounted() {
    this.navshow();
    this.drawLine()
  },
  methods: {
    newnav(i, r) {
      var text = r.target.innerText;
      this.navmsg = text;
      console.log(i, text);
      $(".box_nav").hide();
      this.his = 2;
      this.page = i;
    },
    navshow() {
      if (this.his == 1) {
        $(".box_nav").hide();
        this.his = 2;
      } else {
        $(".box_nav").show();
        this.his = 1;
      }
    },
     drawLine(){
        // 基于准备好的dom，初始化echarts实例
        let myChart = this.$echarts.init(document.getElementById('myChart'))
        // 绘制图表
        myChart.setOption({
            title: { text: '' },
            tooltip: {},
            xAxis: {
                data: ["4-27","4-26","4-25","4-24","4-23","4-22"]
            },
            yAxis: {},
            series: [{
                name: '交易额',
                type: 'bar',
                data: [50, 100, 150, 200, 250, 300]
            }]
        });
    },

  },

};
</script>

<style scoped>
@import "../../assets/personal/css/me_zhibiao.css";
</style>